Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/gofiber/fiber.v2: use UserContext in Middleware for span creation #3035

Merged
merged 10 commits into from
Jan 20, 2025

Conversation

tonyduburque
Copy link
Contributor

@tonyduburque tonyduburque commented Dec 12, 2024

What does this PR do?

The Middleware was incorrectly using c.Context() instead of c.UserContext() to start spans. This could break the propagation of the context defined by other middlewares earlier in the chain.

Motivation

This change ensures that tracer.StartSpanFromContext uses the correct context provided by Fiber, preserving context propagation and ensuring proper tracing behavior.

Fixes #2199

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

…tion

The Middleware was incorrectly using `c.Context()` instead of `c.UserContext()`
to start spans. This could break the propagation of the context defined by other
middlewares earlier in the chain.

This change ensures that `tracer.StartSpanFromContext` uses the correct context
provided by Fiber, preserving context propagation and ensuring proper tracing behavior.

Fixes DataDog#2199
@tonyduburque tonyduburque requested review from a team as code owners December 12, 2024 19:57
… creation

The Middleware was incorrectly using `c.Context()` instead of `c.UserContext()`
to start spans. This could break the propagation of the context defined by other
middlewares earlier in the chain.

This change ensures that `tracer.StartSpanFromContext` uses the correct context
provided by Fiber, preserving context propagation and ensuring proper tracing behavior.

Fixes DataDog#2199
Copy link
Contributor

@rarguelloF rarguelloF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fix and writing the test! @tonyduburque

@rarguelloF rarguelloF enabled auto-merge (squash) January 20, 2025 15:15
@rarguelloF rarguelloF merged commit d8c71d4 into DataDog:main Jan 20, 2025
69 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants